[fix](be) Fix missing decimal precision and scale for legacy decimal data#65419
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
/review |
|
run buildall |
|
Codex automated review failed and did not complete. Error: You've hit your usage limit. Visit https://chatgpt.com/codex/settings/usage to purchase more credits or try again at 11:47 AM. Please inspect the workflow logs and rerun the review after the underlying issue is resolved. |
|
|
||
| namespace { | ||
|
|
||
| void fill_missing_decimal_precision(ColumnMetaPB* meta, const TabletColumn& column) { |
| // Segments written before #26572 do not persist decimal precision/frac in | ||
| // ColumnMetaPB, so recover the logical p/s from TabletSchema before | ||
| // ColumnReader builds DataTypeDecimal. | ||
| fill_missing_decimal_precision_from_schema(&meta, _tablet_schema); |
There was a problem hiding this comment.
如果你再这里修改了,那么上次的fix 还有用没?
另外,这里好像没区分decimalv2还是decimal v3? 比如如果是decimal v2 怎么办?
| } | ||
| } | ||
| } else if (is_numeric_type(type)) { | ||
| } else if (field_is_numeric_type(type)) { |
There was a problem hiding this comment.
删除重复代码is_numeric_type。
|
run buildall |
| // Segments written before #26572 do not persist decimal precision/frac in | ||
| // ColumnMetaPB, so recover the logical p/s from TabletSchema before | ||
| // ColumnReader builds DataTypeDecimal. | ||
| fill_missing_decimal_precision_from_schema(&meta, _tablet_schema); |
There was a problem hiding this comment.
在Segment::_parse_footer 的时候把里面的ColumnMetaPB 改了就行。
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
…data Related PR: apache#26572, apache#63569 Problem Summary: Segments written before decimal ColumnMetaPB precision and scale were persisted can miss decimal precision and scale in metadata. Regular columns, complex decimal children may then build decimal DataType instances without the logical precision/scale from TabletSchema. This change centralizes decimal metadata recovery from TabletSchema, applies it before ColumnReader/DataType creation. Fix legacy segment footer parsing to recover missing decimal precision and scale before column readers and data types are created.
262cfa2 to
4283283
Compare
|
run buildall |
TPC-H: Total hot run time: 29976 ms |
TPC-DS: Total hot run time: 180810 ms |
ClickBench: Total hot run time: 24.88 s |
|
run buildall |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
TPC-H: Total hot run time: 29625 ms |
TPC-DS: Total hot run time: 179789 ms |
ClickBench: Total hot run time: 25.06 s |
|
/review |
There was a problem hiding this comment.
I found one compatibility issue that should be fixed before merge.
Critical checkpoints: the PR goal is to repair legacy decimal segment metadata before ColumnReader/DataTypeDecimal construction. The normal Segment::_parse_footer rowset path is now covered and the change is otherwise focused. I did not find new concurrency, lifecycle, config, persistence, FE/BE protocol, or transaction concerns in the changed files. The remaining risk is compatibility for raw ColumnMetaPB factory callers outside the repaired segment-open path. Test coverage adds segment-parse based DecimalV2/V3 cases, but removes the direct raw-factory regression coverage that would catch this issue.
Validation: git diff --check passed. build-support/check-format.sh could not run because this runner does not have clang-format v16. Targeted ./run-be-ut.sh --run --filter=ColumnReaderCacheTest... could not reach test execution because gensrc failed on missing thirdparty/installed/bin/protoc after the script provisioned some third-party pieces.
User focus: no additional user-provided focus points were supplied.
Subagent conclusions: optimizer-rewrite reported no optimizer/rewrite findings. tests-session-config proposed TSC-1; I verified and accepted it as inline comment M-1. Final convergence round 1 ended with both live subagents replying exactly NO_NEW_VALUABLE_FINDINGS for the same current ledger/comment set.
| meta_precision, meta_scale, -1); | ||
| } | ||
| nested = _create_primitive_data_type(static_cast<FieldType>(pcolumn.type()), | ||
| pcolumn.precision(), pcolumn.frac(), -1); |
There was a problem hiding this comment.
Moving the repair to Segment::_parse_footer fixes the normal rowset read path, but this factory is still used on raw ColumnMetaPBs that never see that schema repair. For example meta_tool reads a segment footer and calls DataTypeFactory::create_data_type(column_meta) directly; for a legacy DecimalV2 footer where precision/frac are absent this line now passes 0/0 into _create_primitive_data_type, and the DecimalV2 constructor rejects original precision 0. Before this PR the factory converted that missing precision to UINT32_MAX, so those raw callers could still construct the type. Please keep the DecimalV2 missing-precision fallback here, or otherwise enforce/cover every raw ColumnMetaPB caller before removing it.
|
skip check_coverage |
…data (apache#65419) Issue Number: close #xxx Related PR: apache#26572, apache#63569 Problem Summary: Segments written before decimal ColumnMetaPB precision and scale were persisted can miss precision and scale for decimal types in metadata . Regular columns, complex decimal children may then build decimal DataType instances without the logical precision/scale from TabletSchema, and result in error "Wrong precision 0, min: 1, max: 76". This change centralizes decimal metadata recovery from TabletSchema, applies it before ColumnReader/DataType creation. Fix reading legacy decimal whose segment metadata is missing decimal precision and scale. - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
…data (#65419) (#65522) Issue Number: close #xxx Pick #65419 Related PR: #26572, #63569 Problem Summary: Segments written before decimal ColumnMetaPB precision and scale were persisted can miss precision and scale for decimal types in metadata . Regular columns, complex decimal children may then build decimal DataType instances without the logical precision/scale from TabletSchema, and result in error "Wrong precision 0, min: 1, max: 76". This change centralizes decimal metadata recovery from TabletSchema, applies it before ColumnReader/DataType creation. Fix reading legacy decimal whose segment metadata is missing decimal precision and scale. - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #26572, #63569
Problem Summary:
Segments written before decimal ColumnMetaPB precision and scale were persisted can miss precision and scale for decimal types in metadata . Regular columns, complex decimal children may then build decimal DataType instances without the logical precision/scale from TabletSchema, and result in error "Wrong precision 0, min: 1, max: 76". This change centralizes decimal metadata recovery from TabletSchema, applies it before ColumnReader/DataType creation.
Release note
Fix reading legacy decimal whose segment metadata is missing decimal precision and scale.
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)